<?php 
use yii\helpers\Html;
use yii\widgets\LinkPager;
?>
<section id="main" class="column main_shadow" style="width: 80%;">
		
		<hr class="split"/>
		<h4 class="alert_info" id="perror">应聘用户信息</h4>
		<article class="module width_full">
			<div class="tab_container">
				<table cellspacing="0" class="tablesorter" > 
					<thead> 
						<tr>
							<th width="25%" class="tc">姓名</th>
							<th width="20%">年龄</th>
							<th width="20%">性别</th>
							<th width="20%">详细信息</th>
							<th width="20%">操作</th>
						</tr>
					</thead>
					<tbody> 
					<?php foreach ($data as $k => $v) {?>
						<tr>
							<td class="tc"><?= $v['name']?></td>
							<td><?= $v['age']?></td>
							<td><?php if($v['sex']==0)echo '男';else echo '女';?></td>
							<td><button type="button" class="btn btn-primary detailed btn-xs" data-toggle="modal" data-target="#myModal">详细信息</button><span style="display:none">姓名：<?= $v['name']?><br>年龄：<?= $v['age']?><br>姓名：<?php if($v['sex']==0)echo '男';else echo '女';?><br>手机号：<?= $v['phone']?><br>介绍：<?= $v['introduce']?><br></span></td>
							<td>
							<button class="btn btn-success btn-xs yes" u_id="<?= $v['id']?>" data-toggle="modal" data-target="#reviseUser">聘用</button>
							<button class="btn btn-danger btn-xs no" u_id="<?= $v['id']?>" data-toggle="modal" data-target="#deleteUser">×</button>
							</td>
						</tr>
					<?php }?>
					</tbody>
				</table>
			</div>
			<?=LinkPager::widget(['pagination' =>$pagination])?>
		</article><!-- end of post new article -->
		<nav class="nav">
			
		</nav>
</section>
<!-- Button trigger modal -->

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">详细信息</h4>
      </div>
      <div class="modal-body">
        
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>
<script>
	$(function(){
		$('.detailed').click(function(){
			$('.modal-body').html($(this).next().html());
		});
		$('.yes').click(function(){
			var id = $(this).attr('u_id');
			$.ajax({
				url:"?w=position/position_upstate",
				data:{id:id,state:1},
				dataType:'json',
				success:function(data){
					if(data.error==1){
						alert(data.msg)
					}else{
						alert(data.msg)
					}
					history.go(0)
				}
			})
		})
		$('.no').click(function(){
			var id = $(this).attr('u_id');
			$.ajax({
				url:"?w=position/position_upstate",
				data:{id:id,state:2},
				dataType:'json',
				success:function(data){
					if(data.error==1){
						alert(data.msg)
					}else{
						alert(data.msg)
					}
					history.go(0)
				}
			})
		})
	})
</script>